/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.tb_areas.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.TreeEntity;

/**
 * 地区管理Entity
 * @author ZhangYangZe
 * @version 2017-05-11
 */
public class TbAreas extends TreeEntity<TbAreas> {
	
	private static final long serialVersionUID = 1L;
	private TbAreas parent;		// 父ID
	private String parentIds;		// 所有父ID
	private String areaname;		// 地点名称
	private String lng;		// 纬度
	private String lat;		// 进度
	private String level;		// 级别
	private String shortname;		// shortname
	private Integer sort;		// 排序
	
	public TbAreas() {
		super();
	}

	public TbAreas(String id){
		super(id);
	}

	@JsonBackReference
	public TbAreas getParent() {
		return parent;
	}

	public void setParent(TbAreas parent) {
		this.parent = parent;
	}
	
	@Length(min=0, max=255, message="所有父ID长度必须介于 0 和 255 之间")
	public String getParentIds() {
		return parentIds;
	}

	public void setParentIds(String parentIds) {
		this.parentIds = parentIds;
	}
	
	@Length(min=0, max=255, message="地点名称长度必须介于 0 和 255 之间")
	public String getAreaname() {
		return areaname;
	}

	public void setAreaname(String areaname) {
		this.areaname = areaname;
	}
	
	@Length(min=0, max=255, message="纬度长度必须介于 0 和 255 之间")
	public String getLng() {
		return lng;
	}

	public void setLng(String lng) {
		this.lng = lng;
	}
	
	@Length(min=0, max=255, message="进度长度必须介于 0 和 255 之间")
	public String getLat() {
		return lat;
	}

	public void setLat(String lat) {
		this.lat = lat;
	}
	
	@Length(min=0, max=255, message="级别长度必须介于 0 和 255 之间")
	public String getLevel() {
		return level;
	}

	public void setLevel(String level) {
		this.level = level;
	}
	
	@Length(min=0, max=255, message="shortname长度必须介于 0 和 255 之间")
	public String getShortname() {
		return shortname;
	}

	public void setShortname(String shortname) {
		this.shortname = shortname;
	}
	
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
	
	public String getParentId() {
		return parent != null && parent.getId() != null ? parent.getId() : "0";
	}
}